/*
 * GLMatrix.h
 *
 *  Created on: 2012-03-08
 *      Author: Aco
 */

#ifndef GLMATRIX_H_
#define GLMATRIX_H_

#include "Vec3D.h"
#include <cstdlib>

class GLMatrix
{
public:
	float m[16];

	void setIdentity();
	void copyFrom(const GLMatrix & g);

	void setToTranslation(float x, float y, float z);
	void setToTranslation(const Vec3D & v);
	void translate(float x, float y, float z);
	void translate(const Vec3D & v);
	void setToXRotation(float angle);
	void setToYRotation(float angle);
	void setToZRotation(float angle);
	void rotate(float x, float y, float z);
	void rotate(const Vec3D & v);
	void setToScale(float x, float y, float z);
	void setToScale(const Vec3D & v);
	void scale(float x, float y, float z);
	void scale(float factor);
	void scale(const Vec3D & v);
	void multiplyBy(const GLMatrix & g);
	void setLookAt(Vec3D eye, Vec3D lookAt, Vec3D up, Vec3D *retU = NULL, Vec3D *retR = NULL, Vec3D *retF = NULL);
	void setPerspective(float left, float right, float bottom, float top, float zNear, float zFar);

	Vec3D getAbsoluteVector() const;

	GLMatrix getTransposed() const;

	GLMatrix();
	GLMatrix(const GLMatrix & g);

	static const GLMatrix Identity;
};


#endif /* GLMATRIX_H_ */
